<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" Codebehind="FileManager.aspx.cs"
    Inherits="ClickSocial.Admin.FileManager1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">

    <script type="text/javascript">
	function btnDeleteFile_Click() 
    {
	    a = window.confirm("Are you sure want to delete this files ?");
	    if(a) {
    		return true;
	    }
	    else {
		    return false;
	    }
    }
    function btnDeleteFolder_Click() {
        a = window.confirm("Are you sure want to delete this folder and files inside?");
	    if(a) {
    		return true;
	    }
	    else {
		    return false;
	    }
    }
    function confirm_delete()
    {
        if (confirm("Are you sure want to delete this item?")==true)
            return true;
        else
            return false;
    }
    function btnDeleteCheckedItems_Click(){
        if (confirm("Are you sure want to delete all the checked items?")==true)
            return true;
        else
            return false;
    }
    </script>

    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Admin/MyEvents.aspx" CssClass="volver">Volver</asp:HyperLink>
	<h4>Administrador de archivos</h4>
    <div style="float:left; font-family: Verdana; font-size: 11px; clear:left; display:inline; padding:10px; width:860px; background-color:#F5F5F5;" >
        <table style="padding: 3px; border-color:Black; border-width:thin;" cellspacing="0" cellpadding="2" border="1" height="100%" width="100%">
            <tr>
                <td colspan="6">
                    <asp:Panel ID="Panel1" runat="server" Visible="false">
                        <asp:LinkButton ID="btnAddFolder" runat="server" CommandName="AddFolder" OnClick="btnAddFolder_Click">
                            <asp:Image ID="IMAGE1" runat="server" AlternateText="Add Folder" ImageUrl="~/images/add_folder.gif" />
                        </asp:LinkButton>&nbsp;
                        <asp:TextBox ID="txtAddFolder" CssClass="textbox" runat="server"></asp:TextBox>&nbsp;
                        <asp:LinkButton ID="btnDeleteFolder" runat="server" CommandName="DeleteFolder" OnClick="btnDeleteFolder_Click"
                            OnClientClick="return btnDeleteFolder_Click();">
                            <asp:Image ID="IMAGE11" runat="server" AlternateText="Delete Folder" ImageUrl="~/images/delete_folder.gif" />
                        </asp:LinkButton>&nbsp;
                    </asp:Panel>
                    <asp:LinkButton ID="btnRefresh" runat="server" CommandName="Refresh" OnClick="btnRefresh_Click">
                        <asp:Image ID="IMAGE3" runat="server" AlternateText="Refresh" ImageUrl="~/images/Refresh.gif" />
                        <asp:Label ID="lblRefresh" runat="server" Text="Refresh"></asp:Label></asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="btnCopyFile" runat="server" CommandName="CopyFile" OnClick="btnCopyFile_Click">
                        <asp:Image ID="IMAGE4" runat="server" AlternateText="Copy File" ImageUrl="~/images/copy_file.gif" />
                        <asp:Label ID="lblCopyFile" runat="server" Text="Copy File"></asp:Label></asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="btnPasteFile" runat="server" CommandName="PasteFile" OnClick="btnPasteFile_Click">
                        <asp:Image ID="IMAGE5" runat="server" AlternateText="Paste File" ImageUrl="~/images/folder_document.gif" />
                        <asp:Label ID="lblPasteFile" runat="server" Text="Paste File"></asp:Label></asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="btnMoveFile" runat="server" CommandName="MoveFile" OnClick="btnMoveFile_Click">
                        <asp:Image ID="IMAGE6" runat="server" AlternateText="Cut File" ImageUrl="~/images/move_file.gif" />
                        <asp:Label ID="Label1" runat="server" Text="Cut File"></asp:Label></asp:LinkButton>&nbsp;
                    <asp:LinkButton ID="btnDeleteFile" runat="server" CommandName="DeleteFile" OnClick="btnDeleteFile_Click"
                        OnClientClick="return btnDeleteCheckedItems_Click()">
                        <asp:Image ID="IMAGE7" runat="server" AlternateText="Delete File" ImageUrl="~/images/delete.gif" />
                        <asp:Label ID="Label3" runat="server" Text="Delete"></asp:Label></asp:LinkButton>
                </td>
            </tr>
            <tr>
                <td width="30%" valign="top" class="fileManagerNombres">
                    <asp:TreeView ID="TreeView1" runat="server" SelectedNodeStyle-CssClass="TreeSelectedNode"
                        OnSelectedNodeChanged="TreeView1_SelectedNodeChanged" SelectedNodeStyle-Font-Underline="true">
                    </asp:TreeView>
                </td>
                <td valign="top" width="70%">
                    <asp:DataGrid ID="dgData" runat="server" CellSpacing="0" CellPadding="0" AutoGenerateColumns="False"
                        Width="100%" BorderWidth="0" OnItemDataBound="dgData_ItemDataBound" OnItemCommand="dgData_ItemCommand"
                        OnEditCommand="dgData_EditCommand" OnUpdateCommand="dgData_UpdateCommand" EnableViewState="true"
                        OnCancelCommand="dgData_CancelCommand" CssClass="TableFile" BorderStyle="none">
                        <Columns>
                            <asp:TemplateColumn HeaderStyle-Width="1%">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkChecked" runat="server"></asp:CheckBox>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderText="Nombe del archivo" SortExpression="fileName" HeaderStyle-Width="420">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgType" runat="server" BorderWidth="0" BorderStyle="None" CommandName="UnzipIt">
                                    </asp:ImageButton>
                                    <asp:LinkButton ID="lnkName" CssClass="FileManager" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"filename") %>'
                                        CommandName="ItemClicked" CausesValidation="false">
                                    </asp:LinkButton>
                                    <a href="iFileDownload.aspx?ID=<%=GetFolderPath()%>\<%# DataBinder.Eval(Container.DataItem,"filename") %>"
                                        target="iFileManager">
                                        <asp:Image ID="btnDownload" runat="server" ToolTip="Download" ImageUrl="~/images/data_down.gif" />
                                    </a>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:ImageButton ID="imgType" runat="server" BorderWidth="0" BorderStyle="None" CommandName="UnzipIt">
                                    </asp:ImageButton>
                                    <asp:TextBox ID="txtEditName" runat="server" Text='<% # DataBinder.Eval(Container.DataItem,"filename")%>'>
                                    </asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderText="Size(Kb)" SortExpression="Size" HeaderStyle-Width="60">
                                <ItemTemplate>
                                    <asp:Label ID="Size" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Size") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Right" />
                                <ItemStyle HorizontalAlign="Right" />
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderStyle-Width="1" ItemStyle-Width="1">
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnRename" runat="server" CommandName="Edit" ToolTip="Rename">
                                        <asp:Image ID="IMAGE9" runat="server" ImageUrl="~/images/Rename.gif" />
                                    </asp:LinkButton>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Update" ToolTip="Update">
                                        <asp:Image ID="IMAGE10" runat="server" ImageUrl="~/images/ok.gif" /></asp:LinkButton>&nbsp;
                                </EditItemTemplate>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderStyle-Width="1" ItemStyle-Width="1">
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete" ToolTip="Delete"
                                        OnClientClick="return btnDeleteFile_Click();">
                                        <asp:Image ID="imgdelete" runat="server" ImageUrl="~/images/del.gif" /></asp:LinkButton>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Cancel" ToolTip="Cancel"
                                        CausesValidation="false">
                                        <asp:Image ID="IMAGE6" runat="server" ImageUrl="~/images/Cancel.gif" /></asp:LinkButton>&nbsp;
                                </EditItemTemplate>
                                <ItemStyle HorizontalAlign="left"></ItemStyle>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderStyle-Width="1" ItemStyle-Width="1">
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnEdit" runat="server" CommandName="Modify" ToolTip="Edit">
                                        <asp:Image ID="IMAGE8" runat="server" ImageUrl="~/images/write.gif" /></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:BoundColumn DataField="Date" SortExpression="Date" ReadOnly="True" HeaderText="Date">
                                <HeaderStyle HorizontalAlign="Right"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Right"></ItemStyle>
                            </asp:BoundColumn>
                        </Columns>
                        <ItemStyle CssClass="tableFManager" BorderStyle="none" BorderWidth="0" />
                        <AlternatingItemStyle CssClass="tableFManager" BorderStyle="none" BorderWidth="0" />
                        <HeaderStyle CssClass="tableHeader" BorderStyle="none" BorderWidth="0" />
                        <FooterStyle CssClass="tableFManager" BorderStyle="none" BorderWidth="0" />
                    </asp:DataGrid>&nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="6">
                    <asp:Label ID="lblCounter" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="6">
                    <asp:Label ID="lblSpaceUsed" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="6">
                    <asp:Label ID="lblError" runat="server" ForeColor="red"></asp:Label>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="BrowserFile"
                        ErrorMessage="Solo se permiten archivos de tipo imagen." ValidationExpression="^.+\.(([jJ][pP][eE]?[gG])|([gG][iI][fF])|([pP][nN][gG]))$"></asp:RegularExpressionValidator></td>
            </tr>
        </table>
        <br />
        <table cellspacing="0" cellpadding="3" width="100%" border="0" align="center">
            <tr>
                <td width="25%">&nbsp;</td>
				<td width="75%">
                    Buscar archivo:
                		<asp:FileUpload ID="BrowserFile" runat="server" CssClass="button" /></td>
            	
            </tr>
            <tr>
			<td>&nbsp;</td>
                <td>
                    Buscar archivo:
                		<asp:FileUpload ID="FileUpload1" runat="server" CssClass="button" /></td>
            	
            </tr>
            <tr>
			<td>&nbsp;</td>
                <td>Buscar archivo:
                <asp:FileUpload ID="FileUpload2" runat="server" CssClass="button" /></td>
            	
            </tr>
            <tr>
			<td>&nbsp;</td>
                <td>Buscar archivo:
                <asp:FileUpload ID="FileUpload3" runat="server" CssClass="button" /></td>
            	
            </tr>
            <tr>
			<td>&nbsp;</td>
                <td>Buscar archivo:
                    <asp:FileUpload ID="FileUpload4" runat="server" CssClass="button" />&nbsp;
                    <asp:LinkButton ID="LinkButton6" runat="server" CommandName="Upload" OnClick="btnUpload_Click">
                    <asp:Image ID="Image14" runat="server" ToolTip="Upload" ImageUrl="~/images/Upload2.gif" />                    </asp:LinkButton>&nbsp;&nbsp; (archivos de hasta 4Mb)</td>
            	
            </tr>
        </table>
        <br />
        <iframe width="0" height="0" scrolling="no" visible="false" tabindex="0" frameborder="0"
            id="iFileManager" name="iFileManager" marginheight="0" marginwidth="0" noresize>
        </iframe>
    </div>
</asp:Content>
